import Vue from 'vue'
import VueRouter from 'vue-router'

// 移动端首页
import mbHome from '../views/mb/mbHome'
// PC端首页
import pcHome from '../views/pc/pcHome'
Vue.use(VueRouter)

const originalReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location) {
    return originalReplace.call(this, location).catch(err => err);
};

const routes = [
  {
    // 移动端首页
    path: '/',
    name: 'mbHome',
    component: mbHome,
    meta: {
      title: '首页'
    }
  },
 {
    // PC端首页
    path: '/pc',
    name: 'pcHome',
    component: pcHome,
    meta: {
      title: '首页'
    }
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
